$NG.AllReady(function (page, { useAction, useBeforeClick, useValuesChange, useClick, useUpdateRow, subscribe, useUpdateRows }) {
    const mstform = $NG.getCmpApi("p_form_kjkhgl_m")
    const dgrid1 = $NG.getCmpApi("p_form_kjkhgl_d1")
    const dgrid2 = $NG.getCmpApi("p_form_kjkhgl_d2")
    const dgrid3 = $NG.getCmpApi("p_form_kjkhgl_d3")

    const getHeadValue = (str) => mstform.getItem(str).getValue()

    useAction("clickHighlight")(function (...e) {
        console.log(`e`,e);
    })
    if (page.oType == 'add') {
        getKjkhglInfo()
        getKjkhglInfoTowOrg()
        getKjkhglInfoTowJy()
    }

    // 获取明细数据
    function getKjkhglInfo() {
        $NG.execServer("getKjkhglInfo", {}, (res) => {
            if (res.count == 0) return
            const datas = JSON.parse(res.data).reduce((value, item) => {
                item.extendObjects.u_zp = 0
                item.extendObjects.u_gskp = 0
                value.push(item.extendObjects)
                return value
            },[])
            dgrid1.addRows(datas)
        })
    }

    function getKjkhglInfoTowOrg() {
        $NG.execServer("getKjkhglInfoTowOrg", {}, (res) => {
            if (res.count == 0) return
            const datas = JSON.parse(res.data).reduce((value, item) => {
                item.extendObjects.u_zp = 0
                item.extendObjects.u_gskp = 0
                value.push(item.extendObjects)
                return value
            },[])
            dgrid2.addRows(datas)
        })
    }

    function getKjkhglInfoTowJy() {
        $NG.execServer("getKjkhglInfoTowJy", {}, (res) => {
            if (res.count == 0) return
            const datas = JSON.parse(res.data).reduce((value, item) => {
                item.extendObjects.u_zp = 0
                item.extendObjects.u_gskp = 0
                value.push(item.extendObjects)
                return value
            },[])
            dgrid3.addRows(datas)
        })
    }
    
},function(){
return {
    /**
     * @param defaultParams:IObject 默认请求参数
     * @return IObject
     */
    transferListReqParams(defaultParams) {
        console.log(`defaultParams`,defaultParams);
    //   return {
    //     ...defaultParams,
    //     userParam: 'test'
    //   };
    }
  };
})